<template>
  <ele-modal
    form
    :width="1400"
    :model-value="modelValue"
    :title="title"
    @update:modelValue="updateModelValue"
  >
    <offer-list :vehicle-id="props.data.vehicle_id" :search="false" />
  </ele-modal>
</template>

<script setup>
  import { ref, watch } from 'vue';
  const emit = defineEmits(['done', 'update:modelValue']);

  import OfferList from '@/views/insurance/offer-list/index.vue';

  const props = defineProps({
    /** 弹窗是否打开 */
    modelValue: Boolean,
    data: Object,
    planId: {
      type: Number,
      default: 0
    },
    vehicleId: {
      type: Number,
      default: 0
    },

    offerType: {
      type: String,
      default: '全部'
    },

    action: String
  });
  const title = ref('');
  const current = ref([]);

  /** 更新modelValue */
  const updateModelValue = (value) => {
    emit('update:modelValue', value);
  };
  watch(
    () => props.modelValue,
    (modelValue) => {
      if (modelValue) {
        title.value = props.data.plate_number + '的报价列表';
      } else {
        console.log('关闭');
      }
    }
  );
</script>
